﻿using DAL.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL.Persistencia
{
    public class File_ServExtra_FotoDAL
    {
        NewTierraEntities Con;

        public File_ServExtra_FotoDAL()
        {
            Con = new NewTierraEntities();
        }

        public int Adicionar(File_ServExtra_Foto fsef)
        {
            try
            {
                Con.AddToFile_ServExtra_Foto(fsef);
                Con.SaveChanges();
                return fsef.fsef_id;
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public List<File_ServExtra_Foto> ObterPorServExtraID(int ServExtraID)
        {
            try
            {
                return Con.File_ServExtra_Foto.Where(a => a.fsef_File_ServExtra_ID == ServExtraID).ToList();
            }
            catch (Exception)
            {
                throw;
            }
        }

        public void Excluir(File_ServExtra_Foto fsef)
        {
            try
            {
                Con.DeleteObject(fsef);
                Con.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
